package com.hy.mydesktop.client.component.factory;

import com.extjs.gxt.ui.client.widget.layout.RowData;
import com.hy.mydesktop.client.component.meta.RowDataModelEnum;
import com.hy.mydesktop.shared.persistence.domain.gxt.GxtComponentMetaNodeModel;

public class RowDataFactory {
	
	/**
	 * 
	 * <ul>
	 * <li>方法含义：创建RowData</li>
	 * <li>方法作者：汤莉</li>
	 * <li>编写日期：2010-8-31；时间：下午下午05:43:09</li>
	 * </ul>
	 * <ul>
	 * <b>修订编号：</b>
	 * <li>修订日期：</li>
	 * <li>修订作者：</li>
	 * <li>修订原因：</li>
	 * <li>修订内容：</li>
	 * </ul>
	 * @param gxtComponentMetaNodeModel
	 * @return
	 */
	public static RowData createRowData(GxtComponentMetaNodeModel gxtComponentMetaNodeModel){
		
		return configureRowData(gxtComponentMetaNodeModel);
	}
	
	/**
	 * 
	 * <ul>
	 * <li>方法含义：配置RowData的相关属性</li>
	 * <li>方法作者：汤莉</li>
	 * <li>编写日期：2010-8-31；时间：下午下午05:43:14</li>
	 * </ul>
	 * <ul>
	 * <b>修订编号：</b>
	 * <li>修订日期：</li>
	 * <li>修订作者：</li>
	 * <li>修订原因：</li>
	 * <li>修订内容：</li>
	 * </ul>
	 * @param gxtComponentMetaNodeModel
	 * @return
	 */
	private static RowData configureRowData(GxtComponentMetaNodeModel gxtComponentMetaNodeModel){
		
		RowData data=createDefaultRowData();
		
		if(gxtComponentMetaNodeModel.get(RowDataModelEnum.WIDTH.name().toLowerCase())!=null)
		{
			data.setWidth((Double)gxtComponentMetaNodeModel.get(RowDataModelEnum.WIDTH.name().toLowerCase()));
		}
		if(gxtComponentMetaNodeModel.get(RowDataModelEnum.HIGHT.name().toLowerCase())!=null)
		{
			data.setHeight((Double)gxtComponentMetaNodeModel.get(RowDataModelEnum.HIGHT.name().toLowerCase()));
		}
			
		
		return data;
	}
	
	/**
	 * 
	 * <ul>
	 * <li>方法含义：创建默认的RowData</li>
	 * <li>方法作者：汤莉</li>
	 * <li>编写日期：2010-8-31；时间：下午下午05:43:58</li>
	 * </ul>
	 * <ul>
	 * <b>修订编号：</b>
	 * <li>修订日期：</li>
	 * <li>修订作者：</li>
	 * <li>修订原因：</li>
	 * <li>修订内容：</li>
	 * </ul>
	 * @return
	 */
	private static RowData createDefaultRowData(){
		RowData data=new RowData();
		
		return data;
	}
}
